package api

import (
	"github.com/gin-gonic/gin"
)

type GroupApi struct {
}

func (p *GroupApi) DeleteHandler(c *gin.Context) {
	groupname := c.Param("group")
	//检查是否为空
	if groupname == "" {
		groupname = c.Query("group")
	}
	if groupname == "" {
		c.JSON(400, gin.H{"error": "缺少必要的参数"})
		return
	}
	err := groupService.Delete(groupname)

	if err != nil {
		c.JSON(400, gin.H{"error": err.Error()})
		return
	} else {
		c.JSON(200, gin.H{"message": "删除成功"})
		return
	}
}
